﻿@{
    Layout = null;
}

<!DOCTYPE html>

<html>
<head>
    <title>洋芋CMS后台管理系统</title>
    <meta http-equiv="content-type" content="text/html;charset=utf-8;" />
    <link type="text/css" rel="stylesheet" href="@Url.Content("Scripts/Ext-4.1.1a/resources/css/Ext-all.css")" />
    <link type="text/css" rel="stylesheet" href="@Url.Content("Scripts/App/resources/css/app.css")" />
    <script type="text/javascript" src="@Url.Content("Scripts/Ext-4.1.1a/bootstrap.js")"></script>
    <script type="text/javascript" src="@Url.Content("Scripts/Ext-4.1.1a/ext-lang-zh_CN.js")"></script>
    @if (Request.IsAuthenticated)
    {
        <script type="text/javascript"src="@Url.Content("Scripts/swfupload/swfupload.js")"></script>
    }
</head>
<body>

    <script>
        Ext.Loader.setConfig({
            enabled: true,                          //是否启用自动加载
            paths: {                                //加载路径
                'Ext.ux': 'Scripts/Ext-4.1.1a/ux',  //插件路径
                'WeCompany': 'Scripts/App'
            }
        });
        //对空间命名一下
        Ext.ns('WeCompany');
    </script>
    @{
        //判断请求是否通过验证
        if (Request.IsAuthenticated)
        {
            var roles = Roles.GetRolesForUser(User.Identity.Name);
            var rolesstring = "";
            foreach (var c in roles)
            {
                rolesstring += string.Format("'{0}',", c);
            }
            rolesstring = rolesstring.Substring(0, rolesstring.Length - 1);
        <script>
            WeCompany.Userinfo = {
                Roles: [
                            @Html.Raw(rolesstring)
                    ]
            };
            WeCompany.postParams = {
                path: null,
                "ASPSESSID": "@Session.SessionID",
                    "AUTHID": "@Request.Cookies[FormsAuthentication.FormsCookieName].Value"
            };
            Ext.onReady(function () {
                //开始创建应用程序
                Ext.application({
                    name: 'WeCompany',          //用来定义应用程序的名称
                    appFolder: 'Scripts/App',   //应用程序的路径
                    autoCreateViewport: true,   //让它自动加载\Script\app\View目录下的Viewport.js文件,因为目录已经在Loader中配置好了，因而不用设置目录。
                    controllers: ['MainPanel']  //
                });
            });
        </script>
        }
        else
        {
        <script>
            Ext.require('Ext.ux.Logon');
            Ext.onReady(function () {

                if (Ext.BLANK_IMAGE_URL.substr(0, 4) != "data") {
                    Ext.BLANK_IMAGE_URL = "Content/Images/s.gif";
                }
                Ext.ux.Logon.show();
            });
        </script>
        }
    }
</body>
</html>
